package cn.mux.jdk8.thread;


public class DrawThread  extends Thread{
	private Account account;
	
	private double drawAmout;
	
    public DrawThread(String name,Account account,double drawAmout) {
		super(name);
		this.account = account;
		this.drawAmout = drawAmout;
	}
	
	
	
	
	
	@Override
	public void run() {
		/*synchronized (account) {
			
			if (account.getBalance()>=drawAmout) {
				System.out.println(getName() + "取钱成功！吐出钞票：" + drawAmout);
				try {
					Thread.sleep(1);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				account.setBalance(account.getBalance() - drawAmout);
				System.out.println("\t 余额为:" + account.getBalance());
			}else{
				System.out.println(getName()+"取钱失败");
			}
		}*/
		
		account.draw(drawAmout);
	}
}
